package com.sc.nft.service.impl;

import com.sc.nft.dao.RoleMenuRelationDao;
import com.sc.nft.entity.RoleMenuRelation;
import com.sc.nft.service.RoleMenuRelationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 角色菜单关系表服务接口实现
 *
 * @author zhangxiangyu
 * @since 2022-02-02 17:11:20
 * @description 
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class RoleMenuRelationServiceImpl implements RoleMenuRelationService {
    private final RoleMenuRelationDao roleMenuRelationDao;

    @Override
    @Transactional
    public boolean distributionMenu(List<RoleMenuRelation> list, Long roleId) {
        roleMenuRelationDao.deleteByRoleId(roleId);
        return roleMenuRelationDao.saveBatch(list);
    }
}